package Handler;

public class ConcreteHandler2 implements Handler {
    private Handler successor;  // 后继处理器

    public void handleRequest(Request request) {
        if (request.getLevel() == 2) {
            // 处理请求
            System.out.println("ConcreteHandler2 handled the request.");
        } else if (successor != null) {
            // 将请求传递给后继处理器
            successor.handleRequest(request);
        }
    }
}
